/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */

#include "mqt_t__reason_code.h"
#include <string.h>

// Code generated by code-generation. DO NOT EDIT.


// Create an empty NULL-struct
static const plc4c_mqtt_read_write_mqt_t__reason_code plc4c_mqtt_read_write_mqt_t__reason_code_null_const;

plc4c_mqtt_read_write_mqt_t__reason_code plc4c_mqtt_read_write_mqt_t__reason_code_null() {
  return plc4c_mqtt_read_write_mqt_t__reason_code_null_const;
}

// Parse function.
plc4c_return_code plc4c_mqtt_read_write_mqt_t__reason_code_parse(plc4c_spi_read_buffer* readBuffer, plc4c_mqtt_read_write_mqt_t__reason_code** _message) {
    plc4c_return_code _res = OK;

    // Allocate enough memory to contain this data structure.
    (*_message) = malloc(sizeof(plc4c_mqtt_read_write_mqt_t__reason_code));
    if(*_message == NULL) {
        return NO_MEMORY;
    }

    _res = plc4c_spi_read_unsigned_byte(readBuffer, 8, (uint8_t*) *_message);

    return _res;
}

plc4c_return_code plc4c_mqtt_read_write_mqt_t__reason_code_serialize(plc4c_spi_write_buffer* writeBuffer, plc4c_mqtt_read_write_mqt_t__reason_code* _message) {
    plc4c_return_code _res = OK;

    _res = plc4c_spi_write_unsigned_byte(writeBuffer, 8, *_message);

    return _res;
}

plc4c_mqtt_read_write_mqt_t__reason_code plc4c_mqtt_read_write_mqt_t__reason_code_value_of(char* value_string) {
    if(strcmp(value_string, "SUCCESS") == 0) {
        return plc4c_mqtt_read_write_mqt_t__reason_code_SUCCESS;
    }
    if(strcmp(value_string, "GRANTED_QOS_1") == 0) {
        return plc4c_mqtt_read_write_mqt_t__reason_code_GRANTED_QOS_1;
    }
    if(strcmp(value_string, "GRANTED_QOS_2") == 0) {
        return plc4c_mqtt_read_write_mqt_t__reason_code_GRANTED_QOS_2;
    }
    if(strcmp(value_string, "DISCONNECT_WITH_WILL_MESSAGE") == 0) {
        return plc4c_mqtt_read_write_mqt_t__reason_code_DISCONNECT_WITH_WILL_MESSAGE;
    }
    if(strcmp(value_string, "NO_MATCHING_SUBSCRIBERS") == 0) {
        return plc4c_mqtt_read_write_mqt_t__reason_code_NO_MATCHING_SUBSCRIBERS;
    }
    if(strcmp(value_string, "NO_SUBSCRIPTION_EXISTED") == 0) {
        return plc4c_mqtt_read_write_mqt_t__reason_code_NO_SUBSCRIPTION_EXISTED;
    }
    if(strcmp(value_string, "CONTINUE_AUTHENTICATION") == 0) {
        return plc4c_mqtt_read_write_mqt_t__reason_code_CONTINUE_AUTHENTICATION;
    }
    if(strcmp(value_string, "RE_AUTHENTICATE") == 0) {
        return plc4c_mqtt_read_write_mqt_t__reason_code_RE_AUTHENTICATE;
    }
    if(strcmp(value_string, "UNSPECIFIED_ERROR") == 0) {
        return plc4c_mqtt_read_write_mqt_t__reason_code_UNSPECIFIED_ERROR;
    }
    if(strcmp(value_string, "MALFORMED_PACKET") == 0) {
        return plc4c_mqtt_read_write_mqt_t__reason_code_MALFORMED_PACKET;
    }
    if(strcmp(value_string, "PROTOCOL_ERROR") == 0) {
        return plc4c_mqtt_read_write_mqt_t__reason_code_PROTOCOL_ERROR;
    }
    if(strcmp(value_string, "IMPLEMENTATION_SPECIFIC_ERROR") == 0) {
        return plc4c_mqtt_read_write_mqt_t__reason_code_IMPLEMENTATION_SPECIFIC_ERROR;
    }
    if(strcmp(value_string, "UNSUPPORTED_PROTOCOL_VERSION") == 0) {
        return plc4c_mqtt_read_write_mqt_t__reason_code_UNSUPPORTED_PROTOCOL_VERSION;
    }
    if(strcmp(value_string, "CLIENT_IDENTIFIER_NOT_VALID") == 0) {
        return plc4c_mqtt_read_write_mqt_t__reason_code_CLIENT_IDENTIFIER_NOT_VALID;
    }
    if(strcmp(value_string, "BAD_USER_NAME_OR_PASSWORD") == 0) {
        return plc4c_mqtt_read_write_mqt_t__reason_code_BAD_USER_NAME_OR_PASSWORD;
    }
    if(strcmp(value_string, "NOT_AUTHORIZED") == 0) {
        return plc4c_mqtt_read_write_mqt_t__reason_code_NOT_AUTHORIZED;
    }
    if(strcmp(value_string, "SERVER_UNAVAILABLE") == 0) {
        return plc4c_mqtt_read_write_mqt_t__reason_code_SERVER_UNAVAILABLE;
    }
    if(strcmp(value_string, "SERVER_BUSY") == 0) {
        return plc4c_mqtt_read_write_mqt_t__reason_code_SERVER_BUSY;
    }
    if(strcmp(value_string, "BANNED") == 0) {
        return plc4c_mqtt_read_write_mqt_t__reason_code_BANNED;
    }
    if(strcmp(value_string, "SERVER_SHUTTING_DOWN") == 0) {
        return plc4c_mqtt_read_write_mqt_t__reason_code_SERVER_SHUTTING_DOWN;
    }
    if(strcmp(value_string, "BAD_AUTHENTICATION_METHOD") == 0) {
        return plc4c_mqtt_read_write_mqt_t__reason_code_BAD_AUTHENTICATION_METHOD;
    }
    if(strcmp(value_string, "KEEP_ALIVE_TIMEOUT") == 0) {
        return plc4c_mqtt_read_write_mqt_t__reason_code_KEEP_ALIVE_TIMEOUT;
    }
    if(strcmp(value_string, "SESSION_TAKEN_OVER") == 0) {
        return plc4c_mqtt_read_write_mqt_t__reason_code_SESSION_TAKEN_OVER;
    }
    if(strcmp(value_string, "TOPIC_FILTER_INVALID") == 0) {
        return plc4c_mqtt_read_write_mqt_t__reason_code_TOPIC_FILTER_INVALID;
    }
    if(strcmp(value_string, "TOPIC_NAME_INVALID") == 0) {
        return plc4c_mqtt_read_write_mqt_t__reason_code_TOPIC_NAME_INVALID;
    }
    if(strcmp(value_string, "PACKET_IDENTIFIER_IN_USE") == 0) {
        return plc4c_mqtt_read_write_mqt_t__reason_code_PACKET_IDENTIFIER_IN_USE;
    }
    if(strcmp(value_string, "PACKET_IDENTIFIER_NOT_FOUND") == 0) {
        return plc4c_mqtt_read_write_mqt_t__reason_code_PACKET_IDENTIFIER_NOT_FOUND;
    }
    if(strcmp(value_string, "RECEIVE_MAXIMUM_EXCEEDED") == 0) {
        return plc4c_mqtt_read_write_mqt_t__reason_code_RECEIVE_MAXIMUM_EXCEEDED;
    }
    if(strcmp(value_string, "TOPIC_ALIAS_INVALID") == 0) {
        return plc4c_mqtt_read_write_mqt_t__reason_code_TOPIC_ALIAS_INVALID;
    }
    if(strcmp(value_string, "PACKET_TOO_LARGE") == 0) {
        return plc4c_mqtt_read_write_mqt_t__reason_code_PACKET_TOO_LARGE;
    }
    if(strcmp(value_string, "MESSAGE_RATE_TO_HIGH") == 0) {
        return plc4c_mqtt_read_write_mqt_t__reason_code_MESSAGE_RATE_TO_HIGH;
    }
    if(strcmp(value_string, "QUOTA_EXCEEDED") == 0) {
        return plc4c_mqtt_read_write_mqt_t__reason_code_QUOTA_EXCEEDED;
    }
    if(strcmp(value_string, "ADMINISTRATIVE_ACTION") == 0) {
        return plc4c_mqtt_read_write_mqt_t__reason_code_ADMINISTRATIVE_ACTION;
    }
    if(strcmp(value_string, "PAYLOAD_FORMAT_INVALID") == 0) {
        return plc4c_mqtt_read_write_mqt_t__reason_code_PAYLOAD_FORMAT_INVALID;
    }
    if(strcmp(value_string, "RETAIN_NOT_SUPPORTED") == 0) {
        return plc4c_mqtt_read_write_mqt_t__reason_code_RETAIN_NOT_SUPPORTED;
    }
    if(strcmp(value_string, "QOS_NOT_SUPPORTED") == 0) {
        return plc4c_mqtt_read_write_mqt_t__reason_code_QOS_NOT_SUPPORTED;
    }
    if(strcmp(value_string, "USE_ANOTHER_SERVER") == 0) {
        return plc4c_mqtt_read_write_mqt_t__reason_code_USE_ANOTHER_SERVER;
    }
    if(strcmp(value_string, "SERVER_MOVED") == 0) {
        return plc4c_mqtt_read_write_mqt_t__reason_code_SERVER_MOVED;
    }
    if(strcmp(value_string, "SHARED_SUBSCRIPTIONS_NOT_SUPPORTED") == 0) {
        return plc4c_mqtt_read_write_mqt_t__reason_code_SHARED_SUBSCRIPTIONS_NOT_SUPPORTED;
    }
    if(strcmp(value_string, "CONNECTION_RATE_EXCEEDED") == 0) {
        return plc4c_mqtt_read_write_mqt_t__reason_code_CONNECTION_RATE_EXCEEDED;
    }
    if(strcmp(value_string, "MAXIMUM_CONNECT_TIME") == 0) {
        return plc4c_mqtt_read_write_mqt_t__reason_code_MAXIMUM_CONNECT_TIME;
    }
    if(strcmp(value_string, "SUBSCRIPTION_IDENTIFIERS_NOT_SUPPORTED") == 0) {
        return plc4c_mqtt_read_write_mqt_t__reason_code_SUBSCRIPTION_IDENTIFIERS_NOT_SUPPORTED;
    }
    if(strcmp(value_string, "WILDCARD_SUBSCRIPTIONS_NOT_SUPPORTED") == 0) {
        return plc4c_mqtt_read_write_mqt_t__reason_code_WILDCARD_SUBSCRIPTIONS_NOT_SUPPORTED;
    }
    return -1;
}

int plc4c_mqtt_read_write_mqt_t__reason_code_num_values() {
  return 43;
}

plc4c_mqtt_read_write_mqt_t__reason_code plc4c_mqtt_read_write_mqt_t__reason_code_value_for_index(int index) {
    switch(index) {
      case 0: {
        return plc4c_mqtt_read_write_mqt_t__reason_code_SUCCESS;
      }
      case 1: {
        return plc4c_mqtt_read_write_mqt_t__reason_code_GRANTED_QOS_1;
      }
      case 2: {
        return plc4c_mqtt_read_write_mqt_t__reason_code_GRANTED_QOS_2;
      }
      case 3: {
        return plc4c_mqtt_read_write_mqt_t__reason_code_DISCONNECT_WITH_WILL_MESSAGE;
      }
      case 4: {
        return plc4c_mqtt_read_write_mqt_t__reason_code_NO_MATCHING_SUBSCRIBERS;
      }
      case 5: {
        return plc4c_mqtt_read_write_mqt_t__reason_code_NO_SUBSCRIPTION_EXISTED;
      }
      case 6: {
        return plc4c_mqtt_read_write_mqt_t__reason_code_CONTINUE_AUTHENTICATION;
      }
      case 7: {
        return plc4c_mqtt_read_write_mqt_t__reason_code_RE_AUTHENTICATE;
      }
      case 8: {
        return plc4c_mqtt_read_write_mqt_t__reason_code_UNSPECIFIED_ERROR;
      }
      case 9: {
        return plc4c_mqtt_read_write_mqt_t__reason_code_MALFORMED_PACKET;
      }
      case 10: {
        return plc4c_mqtt_read_write_mqt_t__reason_code_PROTOCOL_ERROR;
      }
      case 11: {
        return plc4c_mqtt_read_write_mqt_t__reason_code_IMPLEMENTATION_SPECIFIC_ERROR;
      }
      case 12: {
        return plc4c_mqtt_read_write_mqt_t__reason_code_UNSUPPORTED_PROTOCOL_VERSION;
      }
      case 13: {
        return plc4c_mqtt_read_write_mqt_t__reason_code_CLIENT_IDENTIFIER_NOT_VALID;
      }
      case 14: {
        return plc4c_mqtt_read_write_mqt_t__reason_code_BAD_USER_NAME_OR_PASSWORD;
      }
      case 15: {
        return plc4c_mqtt_read_write_mqt_t__reason_code_NOT_AUTHORIZED;
      }
      case 16: {
        return plc4c_mqtt_read_write_mqt_t__reason_code_SERVER_UNAVAILABLE;
      }
      case 17: {
        return plc4c_mqtt_read_write_mqt_t__reason_code_SERVER_BUSY;
      }
      case 18: {
        return plc4c_mqtt_read_write_mqt_t__reason_code_BANNED;
      }
      case 19: {
        return plc4c_mqtt_read_write_mqt_t__reason_code_SERVER_SHUTTING_DOWN;
      }
      case 20: {
        return plc4c_mqtt_read_write_mqt_t__reason_code_BAD_AUTHENTICATION_METHOD;
      }
      case 21: {
        return plc4c_mqtt_read_write_mqt_t__reason_code_KEEP_ALIVE_TIMEOUT;
      }
      case 22: {
        return plc4c_mqtt_read_write_mqt_t__reason_code_SESSION_TAKEN_OVER;
      }
      case 23: {
        return plc4c_mqtt_read_write_mqt_t__reason_code_TOPIC_FILTER_INVALID;
      }
      case 24: {
        return plc4c_mqtt_read_write_mqt_t__reason_code_TOPIC_NAME_INVALID;
      }
      case 25: {
        return plc4c_mqtt_read_write_mqt_t__reason_code_PACKET_IDENTIFIER_IN_USE;
      }
      case 26: {
        return plc4c_mqtt_read_write_mqt_t__reason_code_PACKET_IDENTIFIER_NOT_FOUND;
      }
      case 27: {
        return plc4c_mqtt_read_write_mqt_t__reason_code_RECEIVE_MAXIMUM_EXCEEDED;
      }
      case 28: {
        return plc4c_mqtt_read_write_mqt_t__reason_code_TOPIC_ALIAS_INVALID;
      }
      case 29: {
        return plc4c_mqtt_read_write_mqt_t__reason_code_PACKET_TOO_LARGE;
      }
      case 30: {
        return plc4c_mqtt_read_write_mqt_t__reason_code_MESSAGE_RATE_TO_HIGH;
      }
      case 31: {
        return plc4c_mqtt_read_write_mqt_t__reason_code_QUOTA_EXCEEDED;
      }
      case 32: {
        return plc4c_mqtt_read_write_mqt_t__reason_code_ADMINISTRATIVE_ACTION;
      }
      case 33: {
        return plc4c_mqtt_read_write_mqt_t__reason_code_PAYLOAD_FORMAT_INVALID;
      }
      case 34: {
        return plc4c_mqtt_read_write_mqt_t__reason_code_RETAIN_NOT_SUPPORTED;
      }
      case 35: {
        return plc4c_mqtt_read_write_mqt_t__reason_code_QOS_NOT_SUPPORTED;
      }
      case 36: {
        return plc4c_mqtt_read_write_mqt_t__reason_code_USE_ANOTHER_SERVER;
      }
      case 37: {
        return plc4c_mqtt_read_write_mqt_t__reason_code_SERVER_MOVED;
      }
      case 38: {
        return plc4c_mqtt_read_write_mqt_t__reason_code_SHARED_SUBSCRIPTIONS_NOT_SUPPORTED;
      }
      case 39: {
        return plc4c_mqtt_read_write_mqt_t__reason_code_CONNECTION_RATE_EXCEEDED;
      }
      case 40: {
        return plc4c_mqtt_read_write_mqt_t__reason_code_MAXIMUM_CONNECT_TIME;
      }
      case 41: {
        return plc4c_mqtt_read_write_mqt_t__reason_code_SUBSCRIPTION_IDENTIFIERS_NOT_SUPPORTED;
      }
      case 42: {
        return plc4c_mqtt_read_write_mqt_t__reason_code_WILDCARD_SUBSCRIPTIONS_NOT_SUPPORTED;
      }
      default: {
        return -1;
      }
    }
}

bool plc4c_mqtt_read_write_mqt_t__reason_code_get_disconnect_reason(plc4c_mqtt_read_write_mqt_t__reason_code value) {
  switch(value) {
    case plc4c_mqtt_read_write_mqt_t__reason_code_SUCCESS: { /* '0X00' */
      return true;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_GRANTED_QOS_1: { /* '0X01' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_GRANTED_QOS_2: { /* '0X02' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_DISCONNECT_WITH_WILL_MESSAGE: { /* '0X04' */
      return true;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_CONTINUE_AUTHENTICATION: { /* '0X18' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_RE_AUTHENTICATE: { /* '0X19' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_UNSPECIFIED_ERROR: { /* '0X80' */
      return true;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_MALFORMED_PACKET: { /* '0X81' */
      return true;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_PROTOCOL_ERROR: { /* '0X82' */
      return true;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_IMPLEMENTATION_SPECIFIC_ERROR: { /* '0X83' */
      return true;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_UNSUPPORTED_PROTOCOL_VERSION: { /* '0X84' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_CLIENT_IDENTIFIER_NOT_VALID: { /* '0X85' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_BAD_USER_NAME_OR_PASSWORD: { /* '0X86' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_NOT_AUTHORIZED: { /* '0X87' */
      return true;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_SERVER_UNAVAILABLE: { /* '0X88' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_SERVER_BUSY: { /* '0X89' */
      return true;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_BANNED: { /* '0X8A' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_SERVER_SHUTTING_DOWN: { /* '0X8B' */
      return true;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_BAD_AUTHENTICATION_METHOD: { /* '0X8C' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_KEEP_ALIVE_TIMEOUT: { /* '0X8D' */
      return true;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_SESSION_TAKEN_OVER: { /* '0X8E' */
      return true;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_TOPIC_FILTER_INVALID: { /* '0X8F' */
      return true;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_TOPIC_NAME_INVALID: { /* '0X90' */
      return true;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_PACKET_IDENTIFIER_IN_USE: { /* '0X91' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_PACKET_IDENTIFIER_NOT_FOUND: { /* '0X92' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_RECEIVE_MAXIMUM_EXCEEDED: { /* '0X93' */
      return true;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_TOPIC_ALIAS_INVALID: { /* '0X94' */
      return true;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_PACKET_TOO_LARGE: { /* '0X95' */
      return true;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_MESSAGE_RATE_TO_HIGH: { /* '0X96' */
      return true;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_QUOTA_EXCEEDED: { /* '0X97' */
      return true;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_ADMINISTRATIVE_ACTION: { /* '0X98' */
      return true;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_PAYLOAD_FORMAT_INVALID: { /* '0X99' */
      return true;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_RETAIN_NOT_SUPPORTED: { /* '0X9A' */
      return true;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_QOS_NOT_SUPPORTED: { /* '0X9B' */
      return true;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_USE_ANOTHER_SERVER: { /* '0X9C' */
      return true;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_SERVER_MOVED: { /* '0X9D' */
      return true;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_SHARED_SUBSCRIPTIONS_NOT_SUPPORTED: { /* '0X9E' */
      return true;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_CONNECTION_RATE_EXCEEDED: { /* '0X9F' */
      return true;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_MAXIMUM_CONNECT_TIME: { /* '0XA0' */
      return true;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_SUBSCRIPTION_IDENTIFIERS_NOT_SUPPORTED: { /* '0XA1' */
      return true;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_WILDCARD_SUBSCRIPTIONS_NOT_SUPPORTED: { /* '0XA2' */
      return true;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_NO_MATCHING_SUBSCRIBERS: { /* '0x10' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_NO_SUBSCRIPTION_EXISTED: { /* '0x11' */
      return false;
    }
    default: {
      return 0;
    }
  }
}

plc4c_mqtt_read_write_mqt_t__reason_code plc4c_mqtt_read_write_mqt_t__reason_code_get_first_enum_for_field_disconnect_reason(bool value) {
    switch(value) {
        case false: {
            return plc4c_mqtt_read_write_mqt_t__reason_code_GRANTED_QOS_1;
        }
        case true: {
            return plc4c_mqtt_read_write_mqt_t__reason_code_SUCCESS;
        }
        default: {
            return -1;
        }
    }
}

bool plc4c_mqtt_read_write_mqt_t__reason_code_get_unsuback_response(plc4c_mqtt_read_write_mqt_t__reason_code value) {
  switch(value) {
    case plc4c_mqtt_read_write_mqt_t__reason_code_SUCCESS: { /* '0X00' */
      return true;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_GRANTED_QOS_1: { /* '0X01' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_GRANTED_QOS_2: { /* '0X02' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_DISCONNECT_WITH_WILL_MESSAGE: { /* '0X04' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_CONTINUE_AUTHENTICATION: { /* '0X18' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_RE_AUTHENTICATE: { /* '0X19' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_UNSPECIFIED_ERROR: { /* '0X80' */
      return true;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_MALFORMED_PACKET: { /* '0X81' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_PROTOCOL_ERROR: { /* '0X82' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_IMPLEMENTATION_SPECIFIC_ERROR: { /* '0X83' */
      return true;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_UNSUPPORTED_PROTOCOL_VERSION: { /* '0X84' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_CLIENT_IDENTIFIER_NOT_VALID: { /* '0X85' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_BAD_USER_NAME_OR_PASSWORD: { /* '0X86' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_NOT_AUTHORIZED: { /* '0X87' */
      return true;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_SERVER_UNAVAILABLE: { /* '0X88' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_SERVER_BUSY: { /* '0X89' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_BANNED: { /* '0X8A' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_SERVER_SHUTTING_DOWN: { /* '0X8B' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_BAD_AUTHENTICATION_METHOD: { /* '0X8C' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_KEEP_ALIVE_TIMEOUT: { /* '0X8D' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_SESSION_TAKEN_OVER: { /* '0X8E' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_TOPIC_FILTER_INVALID: { /* '0X8F' */
      return true;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_TOPIC_NAME_INVALID: { /* '0X90' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_PACKET_IDENTIFIER_IN_USE: { /* '0X91' */
      return true;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_PACKET_IDENTIFIER_NOT_FOUND: { /* '0X92' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_RECEIVE_MAXIMUM_EXCEEDED: { /* '0X93' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_TOPIC_ALIAS_INVALID: { /* '0X94' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_PACKET_TOO_LARGE: { /* '0X95' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_MESSAGE_RATE_TO_HIGH: { /* '0X96' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_QUOTA_EXCEEDED: { /* '0X97' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_ADMINISTRATIVE_ACTION: { /* '0X98' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_PAYLOAD_FORMAT_INVALID: { /* '0X99' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_RETAIN_NOT_SUPPORTED: { /* '0X9A' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_QOS_NOT_SUPPORTED: { /* '0X9B' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_USE_ANOTHER_SERVER: { /* '0X9C' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_SERVER_MOVED: { /* '0X9D' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_SHARED_SUBSCRIPTIONS_NOT_SUPPORTED: { /* '0X9E' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_CONNECTION_RATE_EXCEEDED: { /* '0X9F' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_MAXIMUM_CONNECT_TIME: { /* '0XA0' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_SUBSCRIPTION_IDENTIFIERS_NOT_SUPPORTED: { /* '0XA1' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_WILDCARD_SUBSCRIPTIONS_NOT_SUPPORTED: { /* '0XA2' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_NO_MATCHING_SUBSCRIBERS: { /* '0x10' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_NO_SUBSCRIPTION_EXISTED: { /* '0x11' */
      return true;
    }
    default: {
      return 0;
    }
  }
}

plc4c_mqtt_read_write_mqt_t__reason_code plc4c_mqtt_read_write_mqt_t__reason_code_get_first_enum_for_field_unsuback_response(bool value) {
    switch(value) {
        case false: {
            return plc4c_mqtt_read_write_mqt_t__reason_code_GRANTED_QOS_1;
        }
        case true: {
            return plc4c_mqtt_read_write_mqt_t__reason_code_SUCCESS;
        }
        default: {
            return -1;
        }
    }
}

bool plc4c_mqtt_read_write_mqt_t__reason_code_get_suback_response(plc4c_mqtt_read_write_mqt_t__reason_code value) {
  switch(value) {
    case plc4c_mqtt_read_write_mqt_t__reason_code_SUCCESS: { /* '0X00' */
      return true;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_GRANTED_QOS_1: { /* '0X01' */
      return true;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_GRANTED_QOS_2: { /* '0X02' */
      return true;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_DISCONNECT_WITH_WILL_MESSAGE: { /* '0X04' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_CONTINUE_AUTHENTICATION: { /* '0X18' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_RE_AUTHENTICATE: { /* '0X19' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_UNSPECIFIED_ERROR: { /* '0X80' */
      return true;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_MALFORMED_PACKET: { /* '0X81' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_PROTOCOL_ERROR: { /* '0X82' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_IMPLEMENTATION_SPECIFIC_ERROR: { /* '0X83' */
      return true;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_UNSUPPORTED_PROTOCOL_VERSION: { /* '0X84' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_CLIENT_IDENTIFIER_NOT_VALID: { /* '0X85' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_BAD_USER_NAME_OR_PASSWORD: { /* '0X86' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_NOT_AUTHORIZED: { /* '0X87' */
      return true;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_SERVER_UNAVAILABLE: { /* '0X88' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_SERVER_BUSY: { /* '0X89' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_BANNED: { /* '0X8A' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_SERVER_SHUTTING_DOWN: { /* '0X8B' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_BAD_AUTHENTICATION_METHOD: { /* '0X8C' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_KEEP_ALIVE_TIMEOUT: { /* '0X8D' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_SESSION_TAKEN_OVER: { /* '0X8E' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_TOPIC_FILTER_INVALID: { /* '0X8F' */
      return true;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_TOPIC_NAME_INVALID: { /* '0X90' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_PACKET_IDENTIFIER_IN_USE: { /* '0X91' */
      return true;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_PACKET_IDENTIFIER_NOT_FOUND: { /* '0X92' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_RECEIVE_MAXIMUM_EXCEEDED: { /* '0X93' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_TOPIC_ALIAS_INVALID: { /* '0X94' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_PACKET_TOO_LARGE: { /* '0X95' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_MESSAGE_RATE_TO_HIGH: { /* '0X96' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_QUOTA_EXCEEDED: { /* '0X97' */
      return true;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_ADMINISTRATIVE_ACTION: { /* '0X98' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_PAYLOAD_FORMAT_INVALID: { /* '0X99' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_RETAIN_NOT_SUPPORTED: { /* '0X9A' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_QOS_NOT_SUPPORTED: { /* '0X9B' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_USE_ANOTHER_SERVER: { /* '0X9C' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_SERVER_MOVED: { /* '0X9D' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_SHARED_SUBSCRIPTIONS_NOT_SUPPORTED: { /* '0X9E' */
      return true;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_CONNECTION_RATE_EXCEEDED: { /* '0X9F' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_MAXIMUM_CONNECT_TIME: { /* '0XA0' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_SUBSCRIPTION_IDENTIFIERS_NOT_SUPPORTED: { /* '0XA1' */
      return true;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_WILDCARD_SUBSCRIPTIONS_NOT_SUPPORTED: { /* '0XA2' */
      return true;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_NO_MATCHING_SUBSCRIBERS: { /* '0x10' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_NO_SUBSCRIPTION_EXISTED: { /* '0x11' */
      return false;
    }
    default: {
      return 0;
    }
  }
}

plc4c_mqtt_read_write_mqt_t__reason_code plc4c_mqtt_read_write_mqt_t__reason_code_get_first_enum_for_field_suback_response(bool value) {
    switch(value) {
        case false: {
            return plc4c_mqtt_read_write_mqt_t__reason_code_DISCONNECT_WITH_WILL_MESSAGE;
        }
        case true: {
            return plc4c_mqtt_read_write_mqt_t__reason_code_SUCCESS;
        }
        default: {
            return -1;
        }
    }
}

bool plc4c_mqtt_read_write_mqt_t__reason_code_get_auth_reason(plc4c_mqtt_read_write_mqt_t__reason_code value) {
  switch(value) {
    case plc4c_mqtt_read_write_mqt_t__reason_code_SUCCESS: { /* '0X00' */
      return true;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_GRANTED_QOS_1: { /* '0X01' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_GRANTED_QOS_2: { /* '0X02' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_DISCONNECT_WITH_WILL_MESSAGE: { /* '0X04' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_CONTINUE_AUTHENTICATION: { /* '0X18' */
      return true;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_RE_AUTHENTICATE: { /* '0X19' */
      return true;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_UNSPECIFIED_ERROR: { /* '0X80' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_MALFORMED_PACKET: { /* '0X81' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_PROTOCOL_ERROR: { /* '0X82' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_IMPLEMENTATION_SPECIFIC_ERROR: { /* '0X83' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_UNSUPPORTED_PROTOCOL_VERSION: { /* '0X84' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_CLIENT_IDENTIFIER_NOT_VALID: { /* '0X85' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_BAD_USER_NAME_OR_PASSWORD: { /* '0X86' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_NOT_AUTHORIZED: { /* '0X87' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_SERVER_UNAVAILABLE: { /* '0X88' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_SERVER_BUSY: { /* '0X89' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_BANNED: { /* '0X8A' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_SERVER_SHUTTING_DOWN: { /* '0X8B' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_BAD_AUTHENTICATION_METHOD: { /* '0X8C' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_KEEP_ALIVE_TIMEOUT: { /* '0X8D' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_SESSION_TAKEN_OVER: { /* '0X8E' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_TOPIC_FILTER_INVALID: { /* '0X8F' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_TOPIC_NAME_INVALID: { /* '0X90' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_PACKET_IDENTIFIER_IN_USE: { /* '0X91' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_PACKET_IDENTIFIER_NOT_FOUND: { /* '0X92' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_RECEIVE_MAXIMUM_EXCEEDED: { /* '0X93' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_TOPIC_ALIAS_INVALID: { /* '0X94' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_PACKET_TOO_LARGE: { /* '0X95' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_MESSAGE_RATE_TO_HIGH: { /* '0X96' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_QUOTA_EXCEEDED: { /* '0X97' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_ADMINISTRATIVE_ACTION: { /* '0X98' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_PAYLOAD_FORMAT_INVALID: { /* '0X99' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_RETAIN_NOT_SUPPORTED: { /* '0X9A' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_QOS_NOT_SUPPORTED: { /* '0X9B' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_USE_ANOTHER_SERVER: { /* '0X9C' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_SERVER_MOVED: { /* '0X9D' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_SHARED_SUBSCRIPTIONS_NOT_SUPPORTED: { /* '0X9E' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_CONNECTION_RATE_EXCEEDED: { /* '0X9F' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_MAXIMUM_CONNECT_TIME: { /* '0XA0' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_SUBSCRIPTION_IDENTIFIERS_NOT_SUPPORTED: { /* '0XA1' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_WILDCARD_SUBSCRIPTIONS_NOT_SUPPORTED: { /* '0XA2' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_NO_MATCHING_SUBSCRIBERS: { /* '0x10' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_NO_SUBSCRIPTION_EXISTED: { /* '0x11' */
      return false;
    }
    default: {
      return 0;
    }
  }
}

plc4c_mqtt_read_write_mqt_t__reason_code plc4c_mqtt_read_write_mqt_t__reason_code_get_first_enum_for_field_auth_reason(bool value) {
    switch(value) {
        case false: {
            return plc4c_mqtt_read_write_mqt_t__reason_code_GRANTED_QOS_1;
        }
        case true: {
            return plc4c_mqtt_read_write_mqt_t__reason_code_SUCCESS;
        }
        default: {
            return -1;
        }
    }
}

bool plc4c_mqtt_read_write_mqt_t__reason_code_get_pubrel_pubcomp_response(plc4c_mqtt_read_write_mqt_t__reason_code value) {
  switch(value) {
    case plc4c_mqtt_read_write_mqt_t__reason_code_SUCCESS: { /* '0X00' */
      return true;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_GRANTED_QOS_1: { /* '0X01' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_GRANTED_QOS_2: { /* '0X02' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_DISCONNECT_WITH_WILL_MESSAGE: { /* '0X04' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_CONTINUE_AUTHENTICATION: { /* '0X18' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_RE_AUTHENTICATE: { /* '0X19' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_UNSPECIFIED_ERROR: { /* '0X80' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_MALFORMED_PACKET: { /* '0X81' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_PROTOCOL_ERROR: { /* '0X82' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_IMPLEMENTATION_SPECIFIC_ERROR: { /* '0X83' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_UNSUPPORTED_PROTOCOL_VERSION: { /* '0X84' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_CLIENT_IDENTIFIER_NOT_VALID: { /* '0X85' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_BAD_USER_NAME_OR_PASSWORD: { /* '0X86' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_NOT_AUTHORIZED: { /* '0X87' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_SERVER_UNAVAILABLE: { /* '0X88' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_SERVER_BUSY: { /* '0X89' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_BANNED: { /* '0X8A' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_SERVER_SHUTTING_DOWN: { /* '0X8B' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_BAD_AUTHENTICATION_METHOD: { /* '0X8C' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_KEEP_ALIVE_TIMEOUT: { /* '0X8D' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_SESSION_TAKEN_OVER: { /* '0X8E' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_TOPIC_FILTER_INVALID: { /* '0X8F' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_TOPIC_NAME_INVALID: { /* '0X90' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_PACKET_IDENTIFIER_IN_USE: { /* '0X91' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_PACKET_IDENTIFIER_NOT_FOUND: { /* '0X92' */
      return true;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_RECEIVE_MAXIMUM_EXCEEDED: { /* '0X93' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_TOPIC_ALIAS_INVALID: { /* '0X94' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_PACKET_TOO_LARGE: { /* '0X95' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_MESSAGE_RATE_TO_HIGH: { /* '0X96' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_QUOTA_EXCEEDED: { /* '0X97' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_ADMINISTRATIVE_ACTION: { /* '0X98' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_PAYLOAD_FORMAT_INVALID: { /* '0X99' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_RETAIN_NOT_SUPPORTED: { /* '0X9A' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_QOS_NOT_SUPPORTED: { /* '0X9B' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_USE_ANOTHER_SERVER: { /* '0X9C' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_SERVER_MOVED: { /* '0X9D' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_SHARED_SUBSCRIPTIONS_NOT_SUPPORTED: { /* '0X9E' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_CONNECTION_RATE_EXCEEDED: { /* '0X9F' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_MAXIMUM_CONNECT_TIME: { /* '0XA0' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_SUBSCRIPTION_IDENTIFIERS_NOT_SUPPORTED: { /* '0XA1' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_WILDCARD_SUBSCRIPTIONS_NOT_SUPPORTED: { /* '0XA2' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_NO_MATCHING_SUBSCRIBERS: { /* '0x10' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_NO_SUBSCRIPTION_EXISTED: { /* '0x11' */
      return false;
    }
    default: {
      return 0;
    }
  }
}

plc4c_mqtt_read_write_mqt_t__reason_code plc4c_mqtt_read_write_mqt_t__reason_code_get_first_enum_for_field_pubrel_pubcomp_response(bool value) {
    switch(value) {
        case false: {
            return plc4c_mqtt_read_write_mqt_t__reason_code_GRANTED_QOS_1;
        }
        case true: {
            return plc4c_mqtt_read_write_mqt_t__reason_code_SUCCESS;
        }
        default: {
            return -1;
        }
    }
}

bool plc4c_mqtt_read_write_mqt_t__reason_code_get_puback_pubrec_response(plc4c_mqtt_read_write_mqt_t__reason_code value) {
  switch(value) {
    case plc4c_mqtt_read_write_mqt_t__reason_code_SUCCESS: { /* '0X00' */
      return true;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_GRANTED_QOS_1: { /* '0X01' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_GRANTED_QOS_2: { /* '0X02' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_DISCONNECT_WITH_WILL_MESSAGE: { /* '0X04' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_CONTINUE_AUTHENTICATION: { /* '0X18' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_RE_AUTHENTICATE: { /* '0X19' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_UNSPECIFIED_ERROR: { /* '0X80' */
      return true;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_MALFORMED_PACKET: { /* '0X81' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_PROTOCOL_ERROR: { /* '0X82' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_IMPLEMENTATION_SPECIFIC_ERROR: { /* '0X83' */
      return true;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_UNSUPPORTED_PROTOCOL_VERSION: { /* '0X84' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_CLIENT_IDENTIFIER_NOT_VALID: { /* '0X85' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_BAD_USER_NAME_OR_PASSWORD: { /* '0X86' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_NOT_AUTHORIZED: { /* '0X87' */
      return true;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_SERVER_UNAVAILABLE: { /* '0X88' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_SERVER_BUSY: { /* '0X89' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_BANNED: { /* '0X8A' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_SERVER_SHUTTING_DOWN: { /* '0X8B' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_BAD_AUTHENTICATION_METHOD: { /* '0X8C' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_KEEP_ALIVE_TIMEOUT: { /* '0X8D' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_SESSION_TAKEN_OVER: { /* '0X8E' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_TOPIC_FILTER_INVALID: { /* '0X8F' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_TOPIC_NAME_INVALID: { /* '0X90' */
      return true;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_PACKET_IDENTIFIER_IN_USE: { /* '0X91' */
      return true;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_PACKET_IDENTIFIER_NOT_FOUND: { /* '0X92' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_RECEIVE_MAXIMUM_EXCEEDED: { /* '0X93' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_TOPIC_ALIAS_INVALID: { /* '0X94' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_PACKET_TOO_LARGE: { /* '0X95' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_MESSAGE_RATE_TO_HIGH: { /* '0X96' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_QUOTA_EXCEEDED: { /* '0X97' */
      return true;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_ADMINISTRATIVE_ACTION: { /* '0X98' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_PAYLOAD_FORMAT_INVALID: { /* '0X99' */
      return true;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_RETAIN_NOT_SUPPORTED: { /* '0X9A' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_QOS_NOT_SUPPORTED: { /* '0X9B' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_USE_ANOTHER_SERVER: { /* '0X9C' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_SERVER_MOVED: { /* '0X9D' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_SHARED_SUBSCRIPTIONS_NOT_SUPPORTED: { /* '0X9E' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_CONNECTION_RATE_EXCEEDED: { /* '0X9F' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_MAXIMUM_CONNECT_TIME: { /* '0XA0' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_SUBSCRIPTION_IDENTIFIERS_NOT_SUPPORTED: { /* '0XA1' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_WILDCARD_SUBSCRIPTIONS_NOT_SUPPORTED: { /* '0XA2' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_NO_MATCHING_SUBSCRIBERS: { /* '0x10' */
      return true;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_NO_SUBSCRIPTION_EXISTED: { /* '0x11' */
      return false;
    }
    default: {
      return 0;
    }
  }
}

plc4c_mqtt_read_write_mqt_t__reason_code plc4c_mqtt_read_write_mqt_t__reason_code_get_first_enum_for_field_puback_pubrec_response(bool value) {
    switch(value) {
        case false: {
            return plc4c_mqtt_read_write_mqt_t__reason_code_GRANTED_QOS_1;
        }
        case true: {
            return plc4c_mqtt_read_write_mqt_t__reason_code_SUCCESS;
        }
        default: {
            return -1;
        }
    }
}

bool plc4c_mqtt_read_write_mqt_t__reason_code_get_connack_response(plc4c_mqtt_read_write_mqt_t__reason_code value) {
  switch(value) {
    case plc4c_mqtt_read_write_mqt_t__reason_code_SUCCESS: { /* '0X00' */
      return true;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_GRANTED_QOS_1: { /* '0X01' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_GRANTED_QOS_2: { /* '0X02' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_DISCONNECT_WITH_WILL_MESSAGE: { /* '0X04' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_CONTINUE_AUTHENTICATION: { /* '0X18' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_RE_AUTHENTICATE: { /* '0X19' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_UNSPECIFIED_ERROR: { /* '0X80' */
      return true;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_MALFORMED_PACKET: { /* '0X81' */
      return true;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_PROTOCOL_ERROR: { /* '0X82' */
      return true;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_IMPLEMENTATION_SPECIFIC_ERROR: { /* '0X83' */
      return true;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_UNSUPPORTED_PROTOCOL_VERSION: { /* '0X84' */
      return true;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_CLIENT_IDENTIFIER_NOT_VALID: { /* '0X85' */
      return true;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_BAD_USER_NAME_OR_PASSWORD: { /* '0X86' */
      return true;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_NOT_AUTHORIZED: { /* '0X87' */
      return true;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_SERVER_UNAVAILABLE: { /* '0X88' */
      return true;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_SERVER_BUSY: { /* '0X89' */
      return true;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_BANNED: { /* '0X8A' */
      return true;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_SERVER_SHUTTING_DOWN: { /* '0X8B' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_BAD_AUTHENTICATION_METHOD: { /* '0X8C' */
      return true;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_KEEP_ALIVE_TIMEOUT: { /* '0X8D' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_SESSION_TAKEN_OVER: { /* '0X8E' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_TOPIC_FILTER_INVALID: { /* '0X8F' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_TOPIC_NAME_INVALID: { /* '0X90' */
      return true;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_PACKET_IDENTIFIER_IN_USE: { /* '0X91' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_PACKET_IDENTIFIER_NOT_FOUND: { /* '0X92' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_RECEIVE_MAXIMUM_EXCEEDED: { /* '0X93' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_TOPIC_ALIAS_INVALID: { /* '0X94' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_PACKET_TOO_LARGE: { /* '0X95' */
      return true;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_MESSAGE_RATE_TO_HIGH: { /* '0X96' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_QUOTA_EXCEEDED: { /* '0X97' */
      return true;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_ADMINISTRATIVE_ACTION: { /* '0X98' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_PAYLOAD_FORMAT_INVALID: { /* '0X99' */
      return true;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_RETAIN_NOT_SUPPORTED: { /* '0X9A' */
      return true;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_QOS_NOT_SUPPORTED: { /* '0X9B' */
      return true;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_USE_ANOTHER_SERVER: { /* '0X9C' */
      return true;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_SERVER_MOVED: { /* '0X9D' */
      return true;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_SHARED_SUBSCRIPTIONS_NOT_SUPPORTED: { /* '0X9E' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_CONNECTION_RATE_EXCEEDED: { /* '0X9F' */
      return true;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_MAXIMUM_CONNECT_TIME: { /* '0XA0' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_SUBSCRIPTION_IDENTIFIERS_NOT_SUPPORTED: { /* '0XA1' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_WILDCARD_SUBSCRIPTIONS_NOT_SUPPORTED: { /* '0XA2' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_NO_MATCHING_SUBSCRIBERS: { /* '0x10' */
      return false;
    }
    case plc4c_mqtt_read_write_mqt_t__reason_code_NO_SUBSCRIPTION_EXISTED: { /* '0x11' */
      return false;
    }
    default: {
      return 0;
    }
  }
}

plc4c_mqtt_read_write_mqt_t__reason_code plc4c_mqtt_read_write_mqt_t__reason_code_get_first_enum_for_field_connack_response(bool value) {
    switch(value) {
        case false: {
            return plc4c_mqtt_read_write_mqt_t__reason_code_GRANTED_QOS_1;
        }
        case true: {
            return plc4c_mqtt_read_write_mqt_t__reason_code_SUCCESS;
        }
        default: {
            return -1;
        }
    }
}

uint16_t plc4c_mqtt_read_write_mqt_t__reason_code_length_in_bytes(plc4c_mqtt_read_write_mqt_t__reason_code* _message) {
    return plc4c_mqtt_read_write_mqt_t__reason_code_length_in_bits(_message) / 8;
}

uint16_t plc4c_mqtt_read_write_mqt_t__reason_code_length_in_bits(plc4c_mqtt_read_write_mqt_t__reason_code* _message) {
    return 8;
}
